//
//  Routine.h
//  Together_iOS
//
//  Created by applex on 14-3-1.
//  Copyright (c) 2014年 QIU Shuang. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
#import "SSRemoteManagedObject.h"

@class Stop, User;

enum EventType {
    EVENT_FOOD = 1,
    EVENT_ENTERTAINMENT,
    EVENT_MOVIES
};

@interface Plan : SSRemoteManagedObject

@property (nonatomic, retain) NSNumber * remoteID;
@property (nonatomic, retain) NSNumber * status;
@property (nonatomic, retain) NSDate * date;
@property (nonatomic, retain) NSNumber * shared;
@property (nonatomic, retain) NSDate * createdTime;
@property (nonatomic, retain) NSDate * planDate;
@property (nonatomic, retain) NSNumber *rating;
@property (nonatomic, retain) NSString *regions;

@property (nonatomic, retain) User *owner;
@property (nonatomic, retain) NSArray *stops;


- (BOOL)isShared;
- (NSDictionary *)packedDictionary;

- (void)saveToRemoteWithSuccess:(void(^)())successBlock failure:(void(^)(NSError *error))failureBlock;
+ (void)fetchFromServerByRemoteID:(NSNumber *)remoteID success:(void(^)(Plan *plan))successBlock failure:(void(^)(NSError *error))failureBlock;
+ (void)planListFromServerWithSuccess:(void(^)(Plan *plan))successBlock failure:(void(^)(NSError *error))failureBlock;

@end

@interface Plan (CoreDataGeneratedAccessors)

- (void)addStopsObject:(Stop *)value;
- (void)removeStopsObject:(Stop *)value;
- (void)addStops:(NSSet *)values;
- (void)removeStops:(NSSet *)values;


@end
